<?php
 Include ($repertoire_racine."images/themes/config.inc") ;
 Include ($repertoire_racine."images/themes/".$themes [$themes [0][1]][1]."/".$themes [$themes [0][1]][2]) ;
 $aff_version = restaure_configuration_defaut ("SYSTEME_PARAM", "AUTHENTIFICATION", "VERSION", 0) ;
 Echo entete_page ("","") ;
 Echo "<html><head>" ;
 entete_html ("Garennes.", "_self", 0) ;
 Echo styles ("none","none","none",$theme[0][32],"none") ;
 Echo "<script>function ajouter_marque_page(url,titre){if(navigator.appName!='Microsoft Internet Explorer'){window.sidebar.addPanel(titre,url,'');}else{window.external.AddFavorite(url,titre);}}</script>" ;
 Echo "</head><body background=\"./images/fond.png\" bgcolor=\"".$theme [0][3]."\" text=\"".$theme [0][4]."\" onContextMenu=\"return false\">" ;
 Echo "<center><img src=\"./images/logo.png\" border=\"0\">" ; If ($aff_version == 1) { Echo "v".$affichage_version_garennes ; }
 Echo "</center><br>" ;
 If (IsSet ($_GET ["sortie"]))
  {
   Switch ($_GET ["sortie"])
    {
     Case 1 : Echo "<CENTER><B>Le&nbsp;temps&nbsp;d'inactivit&eacute;&nbsp;autoris&eacute;&nbsp;est&nbsp;d&eacute;pass&eacute;&nbsp;!</B></CENTER><BR>" ;
              Break ;
     Case 2 : Echo "<CENTER><B>Mauvais&nbsp;identifiant&nbsp;ou&nbsp;mot&nbsp;de&nbsp;passe&nbsp;!</B></CENTER><BR>" ;
              Break ;
     Case 3 : Echo "<CENTER><B>Le&nbsp;temps&nbsp;de&nbsp;la&nbsp;session&nbsp;autoris&eacute;e&nbsp;est&nbsp;d&eacute;pass&eacute;&nbsp;!</B></CENTER><BR>" ;
              Break ;
     Case 4 : Echo "<CENTER><B>Il&nbsp;y&nbsp;a&nbsp;un&nbsp;probl&egrave;me&nbsp;de&nbsp;droit&nbsp;d'acc&egrave;s&nbsp;!</B></CENTER><BR>" ;
              Break ;
     Case 5 : Echo "<CENTER><B>Le&nbsp;temps&nbsp;d'inactivit&eacute;&nbsp;autoris&eacute;&nbsp;est&nbsp;d&eacute;pass&eacute;&nbsp;!</B><br>" ;
              Echo "Les&nbsp;donn&eacute;es&nbsp;en&nbsp;cours&nbsp;ont&nbsp;&eacute;t&eacute;&nbsp;sauvegard&eacute;es&nbsp;!</CENTER><BR>" ;
              Break ;
    }
  }
 Echo "<form action=\"./index.php\" method=\"post\" name=\"forme\" autocomplete=\"off\">" ;
 $non_centrer = 0 ;
 Include ("./professeurs/include/debut_theme.inc") ;
 Echo "<table border=\"0\" bgcolor=\"".$theme [0][3]."\" cellpadding=\"0\" cellspacing=\"0\">" ;
 Echo "<tr><td colspan=\"2\">&nbsp;</td></tr>" ;
 Echo "<tr>" ;
 Echo "<td align=\"right\">&nbsp;<font color=\"".$theme [0][4]."\">Identifiant&nbsp;:</font>&nbsp;</td>" ;
 Echo "<td align=\"left\">&nbsp;<input type=\"text\" id=\"entree\" name=\"identifiant\" size=\"15\" maxlength=\"200\">&nbsp;</td>" ;
 Echo "</tr>" ;
 Echo "<tr><td colspan=\"2\">&nbsp;</td></tr>" ;
 Echo "<tr>" ;
 Echo "<td align=\"right\">&nbsp;<font color=\"".$theme [0][4]."\">Mot&nbsp;de&nbsp;passe&nbsp;:</font>&nbsp;</td>" ;
 Echo "<td align=\"left\">&nbsp;<input type=\"password\" id=\"entree\" name=\"passe\" size=\"15\" maxlength=\"200\">&nbsp;</td>" ;
 Echo "</tr>" ;
 Echo "<tr><td colspan=\"2\">&nbsp;</td></tr>" ;
 If (IsSet ($bdd) And Is_Array ($bdd) And ($bdd [0][0] > 0))
  {
   // Nombre de bases actives
   $nombre_actives = 0 ;
   For ($i = 1 ; $i <= $bdd [0][0] ; $i++)
    {
     If ($bdd [$i][3] == 1) { $nombre_actives++ ; }
     Else If ($bdd [$i][1] == $sql_base) { $bdd [$i][3] = 1 ; $nombre_actives++ ; }
    }
   If ($nombre_actives > 1)
    {
     Echo "<tr>" ;
     Echo "<td align=\"right\">&nbsp;<font color=\"".$theme [0][4]."\">&Eacute;tablissement&nbsp;:</font>&nbsp;</td>" ;
     Echo "<td align=\"left\">&nbsp;<select name=\"num_bdd_sql\"><option value=\"-1\">Choisissez votre &eacute;tablissement</option>" ;
     For ($i = 1 ; $i <= $bdd [0][0] ; $i++)
      {
       If ($bdd [$i][3] == 1)
        {
         Echo "<option value=\"".$i."\"" ; //If ($sql_base == $bdd [$i][1]) { Echo " selected" ; }
         Echo ">".conversion_car ($bdd [$i][0],FIC_AFFICHAGE_HTML)."</option>" ;
	}
      }
     Echo "</td></tr>" ;
     Echo "<tr><td colspan=\"2\">&nbsp;</td></tr>" ;
    }
  }
 Echo "<tr><td align=\"right\" colspan=\"2\">" ;
 Echo "<input type=\"hidden\" name=\"submit\" value=\"login\">" ;
 Echo "<input type=\"image\" src=\"./images/themes/".$themes [$themes [0][1]][1]."/".$theme [9][0]."\" BORDER=\"0\"></td></tr>" ;
 Echo "</table>" ;

 Include ("./professeurs/include/fin_theme.inc") ;
 Echo "</form>" ;
 Echo "<center><a href=\"javascript:ajouter_marque_page('".$http_garennes."','Garennes. Logiciel de notes.')\">&nbsp;Ajouter cet acc&egrave;s dans votre marque page (ou favoris).&nbsp;</a><br><br>" ;

 If (IsSet ($bdd) And Is_Array ($bdd) And ($bdd [0][0] > 0))
  {
   For ($base = 1 ; $base <= $bdd [0][0] ; $base++)
    {
     SQL_selection_bd ($bdd [$base][1], $id_sql) ;
     $ok = SQL_commande ("SELECT id_etablissement,nom FROM etablissements WHERE cahier_textes='1' AND cahier_public='1' ORDER BY nom", $id_sql) ;
     $nbr = SQL_nbr_lignes ($ok) ;
     For ($i = 0 ; $i < $nbr ; $i++)
      {
       $ligne = SQL_ligne_suivante ($ok) ;
       Echo "<a href=\"./cahier_textes/index.php?id=".$ligne [0]."&base=".$bdd [$base][1]."\">&nbsp;Acc&egrave;s&nbsp;sans&nbsp;restrictions&nbsp;au&nbsp;cahier&nbsp;de&nbsp;texte&nbsp;du&nbsp;\"".$ligne [1]."\"&nbsp;</a><br><br>" ;
      }
    }
  }
 Else
  {
   $ok = SQL_commande ("SELECT id_etablissement,nom FROM etablissements WHERE cahier_textes='1' AND cahier_public='1' ORDER BY nom", $id_sql) ;
   $nbr = SQL_nbr_lignes ($ok) ;
   For ($i = 0 ; $i < $nbr ; $i++)
    {
     $ligne = SQL_ligne_suivante ($ok) ;
     Echo "<a href=\"./cahier_textes/index.php?id=".$ligne [0]."&base=".$bdd [$base][1]."\">&nbsp;Acc&egrave;s&nbsp;sans&nbsp;restrictions&nbsp;au&nbsp;cahier&nbsp;de&nbsp;texte&nbsp;du&nbsp;\"".$ligne [1]."\"&nbsp;</a><br><br>" ;
    }
  }
 Echo "Copyright (c)2000-".Date ("Y").", <a href=\"mailto:jeanfrancois.campan@gmail.com\">&nbsp;Jean-Fran&ccedil;ois&nbsp;Campan&nbsp;</a><br><br>" ;
 Echo "<a href=\"http://garennes.adullact.net\" target=\"_blank\">&nbsp;Visite&nbsp;du&nbsp;site&nbsp;de&nbsp;Garennes&nbsp;</a>" ;
 //$rss= flux_rss ($theme [0][3],$theme [0][35],$theme [0][29]);
 
 Echo "</center></body><script language=\"JavaScript\">window.resizeTo(screen.width,screen.height-35);window.moveTo(0,0);document.forme.identifiant.focus()</script></html>" ;
?>